package com.ts.admin.modules.content;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ts.common.core.utils.Result;
import com.ts.feign.api.CategoryService;
import com.ts.feign.dto.CategoryDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/category")
public class CatetoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping("list")
    public Result<CategoryDTO> list(@RequestParam("page") Integer page) {
        Page<CategoryDTO> mpPage = new Page<>();
        mpPage.setCurrent(page);
        return new Result().ok(categoryService.list(mpPage));
    }

    @PostMapping("save")
    public Result save(@RequestBody CategoryDTO categoryDTO) {
        categoryService.save(categoryDTO);
        return new Result();
    }
}
